//曲线路径
import 'package:flutter/cupertino.dart';

class BottomClipper extends CustomClipper<Path> {
  int copies;
  double bezierHeight;
  BottomClipper({this.copies = 16, this.bezierHeight = 10});
  @override
  Path getClip(Size size) {
    var path = Path();
    path.lineTo(0, 0);
    bezierHeight = size.width / copies;
    var splitSize = size.width / copies;
    for (int j = 0; j < copies; j++) {
      path.lineTo(0 + j * splitSize, size.height);
      var controlPoint =
          Offset(0 + j * splitSize + splitSize / 2, size.height - bezierHeight);
      var ednPoint = Offset(0 + (j + 1) * splitSize, size.height);
      path.quadraticBezierTo(
          controlPoint.dx, controlPoint.dy, ednPoint.dx, ednPoint.dy);
      path.lineTo(0 + (j + 1) * splitSize, size.height);
    }
    path.lineTo(size.width, size.height); //第3个点
    path.lineTo(size.width, 0); //第4个点

    return path;
  }

  @override
  bool shouldReclip(CustomClipper<Path> oldClipper) {
    return false;
  }
}
